package com.genexususa.eo.bing.test.add;

import com.genexususa.eo.bing.connection.CampaignManager;
import com.genexususa.eo.bing.test.TestUtil;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ConsumeAddCampaigns {
    public static void main(String[] args) {
        TestUtil testUtil = new TestUtil();
        String campaignsXML =   "<Bing_CampaignCollection xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                "\t<Campaign xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                "\t\t<BudgetType>DailyBudgetStandard</BudgetType>\n" +
                "\t\t<ConversionTrackingEnabled>false</ConversionTrackingEnabled>\n" +
                "\t\t<DailyBudget>91.20</DailyBudget>\n" +
                "\t\t<DaylightSaving>false</DaylightSaving>\n" +
                "\t\t<Description/>\n" +
                "\t\t<GxCampaignId>699</GxCampaignId>\n" +
                "\t\t<BingCampaignId>0</BingCampaignId>\n" +
                "\t\t<MonthlyBudget>456.00</MonthlyBudget>\n" +
                "\t\t<Name>Regional/Honda</Name>\n" +
                "\t\t<Status>A</Status>\n" +
                "\t\t<TimeZone/>\n" +
                "\t</Campaign>\n" +
                "</Bing_CampaignCollection>";
        /*"<Bing_CampaignCollection>\n" +
                                    "\t<Campaign xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                                        "\t\t<BudgetType>DailyBudgetStandard</BudgetType>\n" +
                                        "\t\t<ConversionTrackingEnabled>true</ConversionTrackingEnabled>\n" +
                                        "\t\t<DailyBudget>1200.00</DailyBudget>\n" +
                                        "\t\t<DaylightSaving>false</DaylightSaving>\n" +
                                        "\t\t<Description>Descripcion de la campaign</Description>\n" +
                                        "\t\t<GxCampaignId>15611534</GxCampaignId>\n" +
                                        "\t\t<MonthlyBudget>12300.02</MonthlyBudget>\n" +
                                        "\t\t<Name>Campaign Acasf</Name>\n" +
                                        "\t\t<Status>Active</Status>\n" +
                                        "\t\t<TimeZone>MidwayIslandand_Samoa</TimeZone>\n" +
                                    "\t</Campaign>\n" +
                                    "\t<Campaign xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                                        "\t\t<BudgetType>DailyBudgetStandard</BudgetType>\n" +
                                        "\t\t<ConversionTrackingEnabled>true</ConversionTrackingEnabled>\n" +
                                        "\t\t<DailyBudget>1201.00</DailyBudget>\n" +
                                        "\t\t<DaylightSaving>false</DaylightSaving>\n" +
                                        "\t\t<Description>Descripcion de la campaign</Description>\n" +
                                        "\t\t<GxCampaignId>5298495</GxCampaignId>\n" +
                                        "\t\t<MonthlyBudget>12301.02</MonthlyBudget>\n" +
                                        "\t\t<Name>Campaign Ac</Name>\n" +
                                        "\t\t<Status>Paused</Status>\n" +
                                        "\t\t<TimeZone>MidwayIslandand_Samoa</TimeZone>\n" +
                                    "\t</Campaign>\n" +
                                "</Bing_CampaignCollection>\n"*/
        CampaignManager resource = new CampaignManager();
        System.out.println("Consuming AddCampaigns.....");

        campaignsXML =   "<Bing_CampaignCollection xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                "\t<Campaign xmlns=\"https://adcenter.microsoft.com/v8\">\n" +
                "\t\t<BudgetType>DailyBudgetStandard</BudgetType>\n" +
                "\t\t<ConversionTrackingEnabled>false</ConversionTrackingEnabled>\n" +
                "\t\t<DailyBudget>91.20</DailyBudget>\n" +
                "\t\t<DaylightSaving>false</DaylightSaving>\n" +
                "\t\t<Description>Campaign Emiliano #3</Description>\n" +
                "\t\t<GxCampaignId>699</GxCampaignId>\n" +
                "\t\t<BingCampaignId>0</BingCampaignId>\n" +
                "\t\t<MonthlyBudget>456.00</MonthlyBudget>\n" +
                "\t\t<Name>Campaign Emiliano #3</Name>\n" +
                "\t\t<Status>A</Status>\n" +
                "\t\t<TimeZone>CentralTimeUSCanada</TimeZone>\n" +
                "\t</Campaign>\n" +
                "</Bing_CampaignCollection>";

        String userName = testUtil.userName;
        String password = testUtil.password;
        String developerToken = testUtil.developerToken;
        long customerId = testUtil.customerId;
        long customerAccountId = testUtil.testAccountEmiliano;
        String applicationId = testUtil.applicationId;
        long accountId = testUtil.accountId1;
        String result = resource.addCampaigns(customerAccountId, campaignsXML);
        System.out.println("Result:\n" + result);
    }
}
